package com.wondersgroup.aida.aiservicedemo;

import com.wondersgroup.aida.tools.ModelUtil;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.service.AiServices;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.V;

/**
 * @author: 紫麒麟vip
 * @create: 2025/2/15
 * Description:
 */
public class AiWriter {
    /**
     * 定义智能体（自定义作家）
     */
    interface Writer{
        @SystemMessage("你是一个散文作家，写一篇散文，题目是{{title}},字数不超过{{count}}个字。")
        String write(@UserMessage String content, @V("title") String title, @V("count") Long count);
    }

    public static void main(String[] args) {
        ChatLanguageModel model = ModelUtil.getOpenAIMOdel();
        // 通过AiServices创建 作家 智能体
        Writer writer = AiServices.create(Writer.class, model);
        String content = writer.write("写一篇作文", "哪吒2观后感", 200L);
        System.out.println(content);
    }
}
